// 主题切换
export default {
    data() {
        return {

        }
    },
    methods: {
        // 切换主题的事件
        changeBg(style) {
            this.nightMode = style;

            if (style) {
                document.getElementsByTagName('body')[0].className = 'night-mode-style'
            } else {
                document.getElementsByTagName('body')[0].className = 'mode-style'

            }
        }
    },

    beforeCreate() {
        if (this.nightMode) {
            // 黑
            document.getElementsByTagName('body')[0].className = 'night-mode-style'
        } else {
            // 白
            document.getElementsByTagName('body')[0].className = 'mode-style'
        }
    },
    created() {
        this.nightMode = false;
        window['changeBg'] = (style) => {
            this.changeBg(style)
        }
    },
    
}